Delete pycache/egg files + fix computer use model - #11
Merged
Conversation
removing ds store, adding gitignore
dmitry-openai
approved these changes
Mar 11, 2025
Contributor
|
I noticed that the pycache folders haven't been completely removed yet . I previously submitted a PR #4 that covers all of them |
DIZ-admin
pushed a commit
to DIZ-admin/openai-agents-python
that referenced
this pull request
Nov 18, 2025
Implemented comprehensive session lifecycle management: - SessionManager class with LRU eviction policy - Automatic cleanup of expired sessions - Connection pooling and reuse - Memory leak prevention Features: - LRU cache with configurable max_sessions limit - Automatic eviction of least recently used sessions - TTL-based session expiration (default: 1 hour) - Background cleanup task (default: 5 minutes interval) - Thread-safe session access with asyncio.Lock - Statistics tracking (cache hits, misses, evictions) Session Lifecycle: 1. get_session() - Get or create session (lazy initialization) 2. Session pooling - Reuse existing sessions 3. LRU eviction - Remove oldest when at capacity 4. TTL expiration - Cleanup inactive sessions 5. Graceful shutdown - Close all sessions on shutdown Memory Leak Prevention: - Proper connection cleanup via clear_session() - Automatic eviction prevents unbounded growth - Background task removes expired sessions - Shutdown closes all active sessions Integration: - Added to DIContainer with lazy initialization - Integrated into initialize() and shutdown() lifecycle - Configurable via ErniConfig.data_dir Configuration: - max_sessions: 100 (prevents memory exhaustion) - session_ttl: 3600 seconds (1 hour) - cleanup_interval: 300 seconds (5 minutes) - db_path: data/sessions.db (persistent storage) Benefits: - Prevents memory leaks from unclosed connections - Reduces database connection overhead - Improves performance with session reuse - Automatic cleanup of stale sessions - Thread-safe concurrent access Tests: - 13 comprehensive unit tests - Test LRU eviction, TTL expiration, cleanup - Test concurrent access, statistics - All tests passing (13/13) Before: - Sessions created but never cleaned up - Database connections left open - Memory usage grows unbounded - No session reuse After: - Automatic session lifecycle management - Proper connection cleanup - Bounded memory usage (max 100 sessions) - Session pooling and reuse - Background cleanup task Resolves: openai#11 (HIGH priority) Impact: Eliminates memory leaks and improves stability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These slipped in because I forgot to add the gitignore initially. Remove them.
Also fixed computer use model